package com.iwhalecloud.bss.kite.cucc.manager.scene.service.operate;

import com.iwhalecloud.bss.kite.common.validate.annotation.KiteNotNull;
import com.iwhalecloud.bss.kite.manager.enums.ActionType;
import com.iwhalecloud.bss.kite.manager.enums.InstType;
import com.iwhalecloud.bss.kite.manager.inst.KiteOfferInst;
import com.iwhalecloud.bss.kite.manager.inst.graph.IRelType;
import com.iwhalecloud.bss.kite.manager.scene.service.operate.OperateOfferInstService;
import com.iwhalecloud.bss.kite.manager.scene.util.InstUtils;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

/**
 * 套餐销售品实例处理类
 */
@Service("manager.operateMemOfferInstService")
public class LocalOperateMemOfferInstService extends OperateOfferInstService {

    /**
     * 添加成员销售品实例(创建场景实例中第一个实例关系图)
     * @param sceneInstId
     * @param offerInst
     * @return
     */
    @Validated
    public String addMemOfferInst(String sceneInstId, @KiteNotNull KiteOfferInst offerInst) {
        InstUtils.checkInstType(offerInst, InstType.MEM_OFFER_INST);
        return addInst(sceneInstId, offerInst);
    }

    /**
     * 把成员销售品实例添加到套餐销售品实例中
     * @param sceneInstId
     * @param offerInst
     * @param offerInstId
     * @param relType
     * @param relActionType
     * @return
     */
    @Validated
    public String addMemOfferInst(String sceneInstId, @KiteNotNull KiteOfferInst offerInst, String offerInstId,
                                   @KiteNotNull IRelType relType, ActionType relActionType) {
        InstUtils.checkInstType(offerInst, InstType.MEM_OFFER_INST);
        return addInstToMainOfferInst(sceneInstId, offerInst, offerInstId, relType, relActionType);
    }
}
